import singleton from "@/utils/libs/singleton";

class Serial {



	send(canId, data) {
		function getRandomIntInclusive(min, max) {
			min = Math.ceil(min);
			max = Math.floor(max);
			return Math.floor(Math.random() * (max - min + 1)) + min;
		}
		console.log("----收到指令----", canId)
		switch (canId) {
			case 1010:
				//干燥压力值
				this.watch(1010, getRandomIntInclusive(50, 200))
				break;
			case 1020:
				//执行测漏
				this.watch(1020)
				break;
			case 1021:
				this.watch(1021, getRandomIntInclusive(50, 200))
				break;
			case 1022:
				this.watch(1022, getRandomIntInclusive(50, 200))
				break;
			case 1030:
				//常压真空预热
				this.watch(1030)
				break;
			case 1040:
				//内胆降压和蒸发器降压
				this.watch(1040, getRandomIntInclusive(50, 200))
				break;
			case 1050:
				//灭菌舱的压力值
				this.watch(1050)
				break;
			case 1051:
				this.watch(1051, getRandomIntInclusive(50, 200))
				break;
			case 1052:
				this.watch(1052, getRandomIntInclusive(50, 200))
				break;
			case 1060:
				//抽真空
				this.watch(1060, getRandomIntInclusive(150, 220))
				break;
			case 1070:
				//等离子
				this.watch(1070, getRandomIntInclusive(150, 220))
				break;
			case 1080:
				//执行测漏
				this.watch(1080, getRandomIntInclusive(150, 220))
				break;

		}

	}

	watch(canId, data) {

	}

}


export default singleton(Serial)